import datetime

from mongoengine import Document, StringField, DictField, DateTimeField, ListField, IntField
from pydantic import BaseModel


class UpdateHtml(BaseModel):
    cid: str
    keyid: str
    html: str
    down_date: str


class PaperGuangmingribaoModel(BaseModel):
    cid: str
    years: str
    moths: str
    days: str
    days_url: str
    versions_title: str
    versions_url: str
    jsondicts: dict
    stat: int
    stathtml: int


class PaperGuangmingribao(Document):
    meta = {'db_alias': 'db30_1'}
    cid = StringField(max_length=50, primary_key=True)
    years = StringField(max_length=20)
    moths = StringField(max_length=20)
    days = StringField(max_length=20)
    days_url = StringField(max_length=200)
    versions_title = StringField(max_length=200)
    versions_url = StringField(max_length=200)
    stat = IntField()
    stathtml = IntField()
    jsondicts = DictField()
    create_time = DateTimeField(default=datetime.datetime.now())
    update_time = DateTimeField(default=datetime.datetime.now())
